package com.allchips.pin.dto;

import com.allchips.pin.domain.PinInfoLc;
import lombok.Data;

import java.util.List;

/**
 * @author gary
 * @date 2022年04月22日 10:40
 */
@Data
public class PinDTO {
    private PinInfoLc pinInfoLc;
    private List<PinInfo> pinInfoList;
    private List<Brand> brandList;

    private Integer pageNo;
    private Integer pageSize;
    private Integer totalCount;
    private Integer totalPageCount;

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        this.computeTotalPage();
    }

    protected void computeTotalPage() {
        if (this.getPageSize() > 0 && this.getTotalCount() > -1L) {
            this.totalPageCount = (int)(this.getTotalCount() % (long)this.getPageSize() == 0L ? this.getTotalCount() / (long)this.getPageSize() : this.getTotalCount() / (long)this.getPageSize() + 1L);
        }

    }


    @Data
    public static class PinInfo {
        private Integer id;
        private String partNumber;
        private Integer standardBrandId;
        private String standardBrandName;
        private Integer kbaseCatId;
        private String cateName;
        private String packing;
        private String tip;
        private List<PinDiff> diffContent;
    }

    @Data
    public static class Brand {
        private Integer id;
        private String name;
        private Integer count;
    }
}
